﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="QuanLyDonDatHang.aspx.cs" Inherits="QuanLyDonDatHang" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
            border: 1px solid #000000;
        }
        .style2
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        <table class="style1">
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:GridView ID="gdv_HoaDon" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                        DataKeyNames="ID" DataSourceID="SqlDataSource_HoaDon" ForeColor="#333333" 
                        GridLines="None" onselectedindexchanged="gdv_HoaDon_SelectedIndexChanged">
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
                            <asp:BoundField DataField="ID" HeaderText="Mã HĐ" InsertVisible="False" 
                                ReadOnly="True" SortExpression="ID" />
                            <asp:BoundField DataField="ThanhVienMuaHang" HeaderText="Khách Hàng" 
                                SortExpression="ThanhVienMuaHang" />
                            <asp:BoundField DataField="MaGianHang" HeaderText="Gian Hàng" 
                                SortExpression="MaGianHang" />
                            <asp:BoundField DataField="TinhTrangHoaDon" HeaderText="Tình Trạng" 
                                SortExpression="TinhTrangHoaDon" />
                            <asp:BoundField DataField="TongSoTienThanhToan" HeaderText="Số Tiền Thanh Toán" 
                                SortExpression="TongSoTienThanhToan" />
                            <asp:BoundField DataField="ThoiGianChuyenHang" 
                                HeaderText="Thời Gian Chuyển Hàng" SortExpression="ThoiGianChuyenHang" />
                            <asp:BoundField DataField="ThoiGianThanhToan" HeaderText="Thời Gian Thanh Toán" 
                                SortExpression="ThoiGianThanhToan" />
                            <asp:BoundField DataField="ThoiGianLapHoatDon" 
                                HeaderText="Thời Gian Lập Hóa  Đơn" SortExpression="ThoiGianLapHoatDon" />
                        </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                    <br />
                    <asp:SqlDataSource ID="SqlDataSource_HoaDon" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        DeleteCommand="DELETE FROM [HOA_DON] WHERE [ID] = @ID" 
                        InsertCommand="INSERT INTO [HOA_DON] ([ThanhVienMuaHang], [MaGianHang], [TinhTrangHoaDon], [TongSoTienThanhToan], [ThoiGianChuyenHang], [ThoiGianThanhToan], [ThoiGianLapHoatDon]) VALUES (@ThanhVienMuaHang, @MaGianHang, @TinhTrangHoaDon, @TongSoTienThanhToan, @ThoiGianChuyenHang, @ThoiGianThanhToan, @ThoiGianLapHoatDon)" 
                        SelectCommand="SELECT * FROM [HOA_DON]" 
                        UpdateCommand="UPDATE [HOA_DON] SET [ThanhVienMuaHang] = @ThanhVienMuaHang, [MaGianHang] = @MaGianHang, [TinhTrangHoaDon] = @TinhTrangHoaDon, [TongSoTienThanhToan] = @TongSoTienThanhToan, [ThoiGianChuyenHang] = @ThoiGianChuyenHang, [ThoiGianThanhToan] = @ThoiGianThanhToan, [ThoiGianLapHoatDon] = @ThoiGianLapHoatDon WHERE [ID] = @ID">
                        <DeleteParameters>
                            <asp:Parameter Name="ID" Type="Int32" />
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="ThanhVienMuaHang" Type="Int32" />
                            <asp:Parameter Name="MaGianHang" Type="Int32" />
                            <asp:Parameter Name="TinhTrangHoaDon" Type="Int32" />
                            <asp:Parameter Name="TongSoTienThanhToan" Type="Int64" />
                            <asp:Parameter Name="ThoiGianChuyenHang" Type="DateTime" />
                            <asp:Parameter Name="ThoiGianThanhToan" Type="DateTime" />
                            <asp:Parameter Name="ThoiGianLapHoatDon" Type="DateTime" />
                            <asp:Parameter Name="ID" Type="Int32" />
                        </UpdateParameters>
                        <InsertParameters>
                            <asp:Parameter Name="ThanhVienMuaHang" Type="Int32" />
                            <asp:Parameter Name="MaGianHang" Type="Int32" />
                            <asp:Parameter Name="TinhTrangHoaDon" Type="Int32" />
                            <asp:Parameter Name="TongSoTienThanhToan" Type="Int64" />
                            <asp:Parameter Name="ThoiGianChuyenHang" Type="DateTime" />
                            <asp:Parameter Name="ThoiGianThanhToan" Type="DateTime" />
                            <asp:Parameter Name="ThoiGianLapHoatDon" Type="DateTime" />
                        </InsertParameters>
                    </asp:SqlDataSource>
                    <br />
                    <br />
                    Mã Hóa Đơn :&nbsp;
                    <asp:TextBox ID="text_MaHD" runat="server" Enabled="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Khách Hàng :
                    <asp:TextBox ID="text_KhachHang" runat="server" Enabled="False" Height="20px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Gian Hàng :
                    <asp:TextBox ID="text_GianHang" runat="server" Enabled="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Tình Trạng :&nbsp;                     <asp:TextBox ID="text_TinhTrang" runat="server" Enabled="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Tổng Số&nbsp; Tiền :
                    <asp:TextBox ID="text_TongTien" runat="server" Enabled="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Thời Gian Chuyển Hàng :
                    <asp:TextBox ID="text_ThoiGianChuyenHang" runat="server"></asp:TextBox>
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/alarm.png" 
                        onclick="ImageButton1_Click" />
                    <br />
                    <asp:CompareValidator ID="CompareValidator1" runat="server" 
                        ControlToCompare="text_ThoiGianLapHoaDon" 
                        ControlToValidate="text_ThoiGianChuyenHang" Enabled="False" 
                        ErrorMessage="Thời Gian Chuyển Hàng phải lớn hơn Thời Gian Lập Hóa Đơn" 
                        Operator="GreaterThan" Type="Date"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Thời Gian Thanh Toán :                    
                    <asp:TextBox ID="text_ThoiGianThanhToan" runat="server"></asp:TextBox>
                    <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Images/alarm.png" 
                        onclick="ImageButton2_Click" />
                    <br />
                    <asp:CompareValidator ID="CompareValidator2" runat="server" 
                        ControlToCompare="text_ThoiGianChuyenHang" 
                        ControlToValidate="text_ThoiGianThanhToan" Enabled="False" 
                        ErrorMessage="Thời Gian Thanh Toán phải lớn hơn Thời Gian Chuyển Hàng" 
                        Operator="GreaterThanEqual" Type="Date"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    Thời Gian Lập Hóa&nbsp; Đơn :
                    <asp:TextBox ID="text_ThoiGianLapHoaDon" runat="server" Enabled="False"></asp:TextBox>
                </td>
            </tr>
        </table>
    </p>
    <p>
        &nbsp;</p>
    <p>
        <table class="style2">
            <tr>
                <td>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btn_CapNhat" runat="server" onclick="btn_CapNhat_Click" 
                        Text="Cập Nhật" Width="70px" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="btn_Xoa" runat="server" onclick="btn_Xoa_Click" Text="Xóa" 
            Width="70px" />
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </p>
    <p>
        <asp:Label ID="kq_capnhat_xoa" runat="server" Text="Label" Font-Size="Large" 
            ForeColor="Red"></asp:Label>
    </p>
    <p>
        <asp:Calendar ID="Calendar1" runat="server" 
            onselectionchanged="Calendar1_SelectionChanged" > </asp:Calendar>
        <asp:Calendar ID="Calendar2" runat="server" 
            onselectionchanged="Calendar2_SelectionChanged" > </asp:Calendar>
        <br />
    </p>
    <p>
        &nbsp;</p>
    <p>
    </p>
</asp:Content>

